﻿#region Using Declarations

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Common.Criteria;
    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.AssignmentFactory, MarketPulse.DataAccess.Factory")]
    public class AssignmentInfo : MarketPulseReadOnlyBase<AssignmentInfo>
    {
        #region Member Variables

            #region Association GUID Member Variables (Foreign Keys)

                /// <summary>
                /// The Guid of the Round associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mRoundGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.RoundGuid);

                /// <summary>
                /// The Guid of the User associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mUserGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.UserGuid);

                /// <summary>
                /// The Guid of the Branch associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mBranchGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.BranchGuid);

                /// <summary>
                /// The Guid of the Reponse associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mResponseGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.ResponseGuid);

                /// <summary>
                /// The Guid of the Survey associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mSurveyGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.SurveyGuid);

                /// <summary>
                /// The Version ID of the Survey associated with this Assignement. When used in conjunction with a SurveyID, this
                /// uniquely identifies a Survey
                /// </summary>
                public static PropertyInfo<Nullable<long>> mSurveyVersionIdProperty = RegisterProperty<Nullable<long>>(p => p.SurveyVersionId);

                /// <summary>
                /// The Guid of the AssignmentStatus associated with this Assignment 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> mAssignmentStatusTypeGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.AssignmentStatusTypeGuid);

            #endregion

            #region Label Member Variables

                /// <summary>
                /// The label for this Assignment 
                /// </summary>
                public static PropertyInfo<string> mLabelProperty = RegisterProperty<string>(p => p.Label);

                /// <summary>
                /// The label for the Client associated with this Assignment 
                /// </summary>
                public static PropertyInfo<string> mClientLabelProperty = RegisterProperty<string>(p => p.ClientLabel);

                /// <summary>
                /// The label for the Branch associated with this Assignment 
                /// </summary>
                public static PropertyInfo<string> mBranchLabelProperty = RegisterProperty<string>(p => p.BranchLabel);

                /// <summary>
                /// The label for the User associated with this Assignment 
                /// </summary>
                public static PropertyInfo<string> mUserLabelProperty = RegisterProperty<string>(p => p.UserLabel);

                /// <summary>
                /// The label for the current Status of this Assignment 
                /// </summary>
                public static PropertyInfo<string> mStatusLabelProperty = RegisterProperty<string>(p => p.StatusLabel);

            #endregion

            #region DateTime Member Variables

                /// <summary>
                /// The start date and time after which the Assignment is valid to be carried out (separated into a specific date and a specific time)
                /// </summary>
                public static PropertyInfo<SmartDate> mValidStartDateTimeProperty = RegisterProperty<SmartDate>(p => p.ValidStartDateTime);

                /// <summary>
                /// The end date and time by which the Assignment must be carried out (separated into a specific date and a specific time)
                /// </summary>
                public static PropertyInfo<SmartDate> mValidEndDateTimeProperty = RegisterProperty<SmartDate>(p => p.ValidEndDateTime);

                /// <summary>
                /// The date and time that the Assignment is planned to be carried out
                /// </summary>
                public static PropertyInfo<SmartDate> mPlannedDateTimeProperty = RegisterProperty<SmartDate>(p => p.PlannedDateTime);

                /// <summary>
                /// The date and time that the Assignment was actually carried out (started)
                /// </summary>
                public static PropertyInfo<SmartDate> mActualStartDateTimeProperty = RegisterProperty<SmartDate>(p => p.ActualStartDateTime);

                /// <summary>
                /// The date and time that the Assignment was actually carried out (ended)
                /// </summary>
                public static PropertyInfo<SmartDate> mActualEndDateTimeProperty = RegisterProperty<SmartDate>(p => p.ActualEndDateTime);

            #endregion

            /// <summary>
            /// The Version ID of this Assigment. When used in conjunction with the Guid, this
            /// uniquely identifies this Assignment
            /// </summary>
            public static PropertyInfo<Nullable<long>> mVersionIdProperty = RegisterProperty<Nullable<long>>(p => p.VersionId);

        #endregion

        #region Constructor(s)

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private AssignmentInfo()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to retrieve a single Assignment object based on the unique criteria (Guid and versionId) provided
                /// </summary>
                /// <param name="assignmentGuid">The Guid of the object to be retrieved</param>
                /// <param name="assignmentVersionId">The VersionId of the object to be retrieved</param>
                /// <returns>A valid Assignment object (populated or empty)</returns>
                public static AssignmentInfo Get(Guid assignmentGuid, long assignmentVersionId)
                {
                    return DataPortal.Fetch<AssignmentInfo>(new UniqueAssignmentCriteria(assignmentGuid, assignmentVersionId));
                }

            #endregion

        #endregion

        #region Properties

            #region Association GUID Properties (Foreign Keys)

                /// <summary>
                /// The Guid of the Round associated with this Assignment 
                /// </summary>
                public Nullable<Guid> RoundGuid { get { return GetProperty(mRoundGuidProperty); } }

                /// <summary>
                /// The Guid of the User associated with this Assignment 
                /// </summary>
                public Nullable<Guid> UserGuid { get { return GetProperty(mUserGuidProperty); }  }

                /// <summary>
                /// The Guid of the Branch associated with this Assignment 
                /// </summary>
                public Nullable<Guid> BranchGuid { get { return GetProperty(mBranchGuidProperty); } }

                /// <summary>
                /// The Guid of the Response associated with this Assignment 
                /// </summary>
                public Nullable<Guid> ResponseGuid { get { return GetProperty(mResponseGuidProperty); } }

                /// <summary>
                /// The Guid of the Survey associated with this Assignment 
                /// </summary>
                public Nullable<Guid> SurveyGuid { get { return GetProperty(mSurveyGuidProperty); } }

                /// <summary>
                /// The Version ID of the Survey associated with this Assignement. When used in conjunction with a SurveyID, this
                /// uniquely identifies a Survey
                /// </summary>
                public Nullable<long> SurveyVersionId { get { return GetProperty(mSurveyVersionIdProperty); } }

                /// <summary>
                /// The Guid of the AssignmentStatus associated with this Assignment 
                /// </summary>
                public Nullable<Guid> AssignmentStatusTypeGuid { get { return GetProperty(mAssignmentStatusTypeGuidProperty); } }

            #endregion

            #region Label Properties

                /// <summary>
                /// The label for his Assignment 
                /// </summary>
                public string Label { get { return GetProperty(mLabelProperty); } }

                /// <summary>
                /// The label for the Client associated with this Assignment 
                /// </summary>
                public string ClientLabel { get { return GetProperty(mClientLabelProperty); } }

                /// <summary>
                /// The label for the Branch associated with this Assignment 
                /// </summary>
                public string BranchLabel { get { return GetProperty(mBranchLabelProperty); } }

                /// <summary>
                /// The label for the User associated with this Assignment 
                /// </summary>
                public string UserLabel { get { return GetProperty(mUserLabelProperty); } }

                /// <summary>
                /// The label for the current Status of this Assignment 
                /// </summary>
                public string StatusLabel { get { return GetProperty(mStatusLabelProperty); } }

            #endregion

            #region DateTime Properties

                /// <summary>
                /// The start date and time after which the assignment is valid to be carried out (separated into a specific date and a specific time)
                /// </summary>
                public SmartDate ValidStartDateTime { get { return GetProperty(mValidStartDateTimeProperty); } }

                /// <summary>
                /// The end date and time by which the assignment must be carried out (separated into a specific date and a specific time)
                /// </summary>
                public SmartDate ValidEndDateTime { get { return GetProperty(mValidEndDateTimeProperty); } }

                /// <summary>
                /// The date and time that the Assignment is planned to be carried out
                /// </summary>
                public SmartDate PlannedDateTime { get { return GetProperty(mPlannedDateTimeProperty); } }

                /// <summary>
                /// The date and time that the Assignment was actually carried out (started)
                /// </summary>
                public SmartDate ActualStartDateTime { get { return GetProperty(mActualStartDateTimeProperty); } }

                /// <summary>
                /// The date and time that the Assignment was actually carried out (Ended)
                /// </summary>
                public SmartDate ActualEndDateTime { get { return GetProperty(mActualEndDateTimeProperty); } }

            #endregion

            /// <summary>
            /// The Version ID of this Assigment. When used in conjunction with the Guid, this
            /// uniquely identifies this Assignment
            /// </summary>
            public Nullable<long> VersionId { get { return GetProperty(mVersionIdProperty); } }

        #endregion
    }
}
